package cn.edu.ldu.protocol;

import cn.edu.ldu.entity.GroupChatEntity;
import cn.edu.ldu.util.L;
import cn.edu.ldu.views.controller.MainUIController;
import cn.edu.ldu.views.main.MainUI;
import cn.edu.ldu.views.operator.AddGroups;
import com.alibaba.fastjson.JSONObject;

import javax.swing.*;

public class GroupResult {
    public GroupResult(Protocol protocol){
        GroupChatEntity groupChatEntity = JSONObject.parseObject(protocol.getData(),GroupChatEntity.class);

        L.OK(groupChatEntity,GroupResult.class);
        if (groupChatEntity==null){
            JOptionPane.showMessageDialog(MainUIController.getMainUI(),"没有该群聊");
        }else {
            new AddGroups(groupChatEntity).setVisible(true);
        }
    }
}
